<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<button onclick="big()">大</button>
<button onclick="sim()">小</button>
<script>
    var arr = [  //假设这是你原来的数组数据
            {
                name: "张三",
                time: "2018-06-12",
                value: "优",
                num: "1",
            },
            {
                name: "张三",
                time: "2018-06-12",
                value: "优秀",
                num: "2"
            },
            {
                name: "张三",
                time: "2018-06-12",
                value: "优秀",
                num: "3"
            },
            {
                name: "张三",
                time: "2018-06-12",
                value: "优秀",
                num: "4"
            }
        ],
        len = arr.length


    //大
    function b() {
        for (var i = 0; i < len; i++) {
            for (var j = 0; j < len - 1 - i; j++) {
                if (arr[j].num > arr[j + 1].num) { //相邻元素两两对比
                    var temp = arr[j + 1]; //元素交换
                    arr[j + 1] = arr[j];
                    arr[j] = temp;
                }
            }
        }

        for (var i = 0; i < len; i++) {
            arr[i]["ind"] = i + 1;
            document.write(arr[i].ind + "序号" + arr[i].name + "值" + arr[i].num + "</br>");
        }
    }

    function a() {
        for (var i = 0; i < len; i++) {
            for (var j = 0; j < len - 1 - i; j++) {
                if (arr[j].num < arr[j + 1].num) { //相邻元素两两对比
                    var temp = arr[j + 1]; //元素交换
                    arr[j + 1] = arr[j];
                    arr[j] = temp;
                }
            }
        }

        for (var i = 0; i < len; i++) {
            arr[i]["ind"] = i + 1;
            document.write(arr[i].ind + "序号" + arr[i].name + "值" + arr[i].num + "</br>");
        }
    }

    //    console.log(arr);

    function sim() {
        b()
    }

    function big() {
        a()
    }
</script>
</body>
</html>